import api from "../../http/apis/apis"

export default {
    namespaced: true,
    state: {
        users:[],
        userID:'',
        sers:{},//被评价人信息
    },
    mutations: {
        setUsers(state,setUser){
            state.users =setUser
        },
        setID(state,ser){
            state.userID = ser
        },
        sers(state,ss){
            state.sers = ss
        }
    },
    actions: {
        async getUserComments(context){
            const data = await api.customerCommentApi.getUserComents()
            const setUser = data.data.data;
            const ser = data.data.data[0].usersID
            context.commit("setUsers",setUser)
            context.commit("setID",ser)
        },
        async getUser(context,_id){
            const data = await api.userApi.getUserByID({_id});
            context.commit("sers",data.data.data.gotUser[0])
        },
        async deletComments(context,_id){
            const data = await api.customerCommentApi.deletComments(_id)
            console.log(data);
        }
    },
    model: {
    }
}